#!/bin/sh
if [ "$1x" = "x" -o "$2x" = "x" ]
then
{
	echo 1;
} else {
	if [ -f "$1" -a -d "$2" ]
	then
	{
	        for a in `echo "$1" | sed 's/\// /g'`
		   do
			i=$a;
		   done 
		if [ -f "$2""/""$i"".0" ]; then {
                         val=`ls "$2"'/'"$i"'.'* | wc -l`
                         mv "$1" "$2""/""$i""."$val

                } else {
                         mv "$1" "$2""/""$i"".0"
                }
                fi
	}
	elif [ -d "$1" -a -d "$2" ]
	then
	{
		for i in `ls "$1"`
		do
	    		if [ -f "$2""/""$i"".0" ]; then {
	   	  		val=`ls "$2"'/'"$i"'.'* | wc -l`
		  		mv "$1""/""$i" "$2""/""$i""."$val
		   
	    		} else {
		  		mv "$1""/""$i" "$2""/""$i"".0"
	    		}
	    		fi
		done
		echo 0;
	} else {
		echo 1;
	}
	fi
}
fi
